package ua.org.nuos.wclientgui.pages;

import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
import org.apache.wicket.markup.html.basic.Label;
import ua.org.nuos.sdms.middle.entity.enums.Role;
import ua.org.nuos.sdms.middle.service.AuthenticationLocal;

import javax.ejb.EJB;

/**
 * Created with IntelliJ IDEA.
 * User: dio
 * Date: 9/16/12
 * Time: 7:35 PM
 * To change this template use File | Settings | File Templates.
 */
@AuthorizeInstantiation(Role.client)
public class MainPage extends BasePage {

    @EJB(name = "ejb/AuthenticationLocal")
    private AuthenticationLocal authenticationBean;

    public MainPage() {
        super();
        add(new Label("statusId", "Authenticate as " +
                (authenticationBean.isUserInRole(Role.client) ? "client" : "") +
                (authenticationBean.isUserInRole(Role.administrator) ? "administrator" : "")));
    }
}
